﻿using System;
using System.Windows;
using appladen.contracts;

namespace appladen.gui
{
    /// <summary>
    ///   Interaction logic for DetailView.xaml
    /// </summary>
    public partial class DetailView : Window, IDetailView
    {
        public DetailView()
        {
            InitializeComponent();
        }

        public void Inject(IDetailViewmodel independent)
        {
            independent.PropertyChanged += (sender,args) => this.Focus();
            DataContext = independent;
            Show();
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            ((IDetailViewmodel) DataContext).Close();
        }
    }
}